<?php
namespace Business\Controller;
use Think\Controller;
class LoginController extends BaseController {
	
	public static $session;		//SESSION
	
	protected function _initialize(){
		self::$session=$_SESSION['business'];		//session
		
	}
	//=============
	public function index(){
		p($_SESSION);
	}
	//登录
	public function login(){
		if(IS_POST){
			$p=I('post.');
			$re=M('bb_shop')->where(array('username'=>$p['username']))->find();
			echo 1;die;
			if($re['password']==md5($p['password'])){
				$res=M('bb_shop')->where(array('id'=>$re['id']))->save(array('wx_openid'=>self::$session['openid']));
				if($res){
					$info['status']=1;
					$info['msg']='ok！';
				}else{
					$info['status']=0;
					$info['msg']='no！';
				}
			    $this->ajaxreturn($info);
			}
		}else{
			$this->display();
		}
	}
	
	
}